<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Bundler::Dsl - bundler: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="RubyDsl.html">Bundler::RubyDsl</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-evaluate">::evaluate</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-add_git_sources">#add_git_sources</a>
    <li ><a href="#method-i-check_path_source_safety">#check_path_source_safety</a>
    <li ><a href="#method-i-check_primary_source_safety">#check_primary_source_safety</a>
    <li ><a href="#method-i-check_rubygems_source_safety">#check_rubygems_source_safety</a>
    <li ><a href="#method-i-env">#env</a>
    <li ><a href="#method-i-eval_gemfile">#eval_gemfile</a>
    <li ><a href="#method-i-gem">#gem</a>
    <li ><a href="#method-i-gemfile_root">#gemfile_root</a>
    <li ><a href="#method-i-gemspec">#gemspec</a>
    <li ><a href="#method-i-git">#git</a>
    <li ><a href="#method-i-git_source">#git_source</a>
    <li ><a href="#method-i-github">#github</a>
    <li ><a href="#method-i-group">#group</a>
    <li ><a href="#method-i-implicit_global_source_warning">#implicit_global_source_warning</a>
    <li ><a href="#method-i-install_if">#install_if</a>
    <li ><a href="#method-i-method_missing">#method_missing</a>
    <li ><a href="#method-i-multiple_global_source_warning">#multiple_global_source_warning</a>
    <li ><a href="#method-i-normalize_group_options">#normalize_group_options</a>
    <li ><a href="#method-i-normalize_hash">#normalize_hash</a>
    <li ><a href="#method-i-normalize_options">#normalize_options</a>
    <li ><a href="#method-i-normalize_source">#normalize_source</a>
    <li ><a href="#method-i-path">#path</a>
    <li ><a href="#method-i-platform">#platform</a>
    <li ><a href="#method-i-platforms">#platforms</a>
    <li ><a href="#method-i-plugin">#plugin</a>
    <li ><a href="#method-i-source">#source</a>
    <li ><a href="#method-i-to_definition">#to_definition</a>
    <li ><a href="#method-i-valid_keys">#valid_keys</a>
    <li ><a href="#method-i-validate_keys">#validate_keys</a>
    <li ><a href="#method-i-with_source">#with_source</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Bundler::Dsl">
    <h1 id="class-Bundler::Dsl" class="class">
      class Bundler::Dsl
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="GITHUB_PULL_REQUEST_URL">GITHUB_PULL_REQUEST_URL
          <dd>
          <dt id="VALID_KEYS">VALID_KEYS
          <dd>
          <dt id="VALID_PLATFORMS">VALID_PLATFORMS
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-dependencies" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">dependencies</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-gemspecs" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">gemspecs</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-evaluate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">evaluate</span><span
                                class="method-args">(gemfile, lockfile, unlock)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="evaluate-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">evaluate</span>(<span class="ruby-identifier">gemfile</span>, <span class="ruby-identifier">lockfile</span>, <span class="ruby-identifier">unlock</span>)
  <span class="ruby-identifier">builder</span> = <span class="ruby-identifier">new</span>
  <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">eval_gemfile</span>(<span class="ruby-identifier">gemfile</span>)
  <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">to_definition</span>(<span class="ruby-identifier">lockfile</span>, <span class="ruby-identifier">unlock</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-ivar">@source</span>               = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@sources</span>              = <span class="ruby-constant">SourceList</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@git_sources</span>          = {}
  <span class="ruby-ivar">@dependencies</span>         = []
  <span class="ruby-ivar">@groups</span>               = []
  <span class="ruby-ivar">@install_conditionals</span> = []
  <span class="ruby-ivar">@optional_groups</span>      = []
  <span class="ruby-ivar">@platforms</span>            = []
  <span class="ruby-ivar">@env</span>                  = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@ruby_version</span>         = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@gemspecs</span>             = []
  <span class="ruby-ivar">@gemfile</span>              = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@gemfiles</span>             = []
  <span class="ruby-identifier">add_git_sources</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-check_primary_source_safety" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_primary_source_safety</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_primary_source_safety-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 268</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_primary_source_safety</span>
  <span class="ruby-identifier">check_path_source_safety</span>
  <span class="ruby-identifier">check_rubygems_source_safety</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-env" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">env</span><span
                                class="method-args">(name) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="env-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 252</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">env</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">old</span> = <span class="ruby-ivar">@env</span>
  <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">old</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-eval_gemfile" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">eval_gemfile</span><span
                                class="method-args">(gemfile, contents = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="eval_gemfile-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">eval_gemfile</span>(<span class="ruby-identifier">gemfile</span>, <span class="ruby-identifier">contents</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">expanded_gemfile_path</span> = <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gemfile</span>).<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@gemfile</span>&amp;.<span class="ruby-identifier">parent</span>)
  <span class="ruby-identifier">original_gemfile</span> = <span class="ruby-ivar">@gemfile</span>
  <span class="ruby-ivar">@gemfile</span> = <span class="ruby-identifier">expanded_gemfile_path</span>
  <span class="ruby-ivar">@gemfiles</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">expanded_gemfile_path</span>
  <span class="ruby-identifier">contents</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">read_file</span>(<span class="ruby-ivar">@gemfile</span>.<span class="ruby-identifier">to_s</span>)
  <span class="ruby-identifier">instance_eval</span>(<span class="ruby-identifier">contents</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">tap</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">untaint</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&lt;</span> <span class="ruby-string">&quot;2.7&quot;</span> }, <span class="ruby-identifier">gemfile</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-value">1</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span> <span class="ruby-comment"># rubocop:disable Lint/RescueException</span>
  <span class="ruby-identifier">message</span> = <span class="ruby-string">&quot;There was an error &quot;</span> \
    <span class="ruby-node">&quot;#{e.is_a?(GemfileEvalError) ? &quot;evaluating&quot; : &quot;parsing&quot;} &quot;</span> \
    <span class="ruby-node">&quot;`#{File.basename gemfile.to_s}`: #{e.message}&quot;</span>

  <span class="ruby-identifier">raise</span> <span class="ruby-constant">DSLError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">gemfile</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>, <span class="ruby-identifier">contents</span>)
<span class="ruby-keyword">ensure</span>
  <span class="ruby-ivar">@gemfile</span> = <span class="ruby-identifier">original_gemfile</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gem" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gem</span><span
                                class="method-args">(name, *args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="gem-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 94</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gem</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> {}
  <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;gemfile&quot;</span>] = <span class="ruby-ivar">@gemfile</span>
  <span class="ruby-identifier">version</span> = <span class="ruby-identifier">args</span> <span class="ruby-operator">||</span> [<span class="ruby-string">&quot;&gt;= 0&quot;</span>]

  <span class="ruby-identifier">normalize_options</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">options</span>)

  <span class="ruby-identifier">dep</span> = <span class="ruby-constant">Dependency</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">options</span>)

  <span class="ruby-comment"># if there&#39;s already a dependency with this name we try to prefer one</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">current</span> = <span class="ruby-ivar">@dependencies</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span> }
    <span class="ruby-identifier">deleted_dep</span> = <span class="ruby-ivar">@dependencies</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">current</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">current</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:development</span>

    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">deleted_dep</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">current</span>.<span class="ruby-identifier">requirement</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">requirement</span>
        <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:development</span>

        <span class="ruby-identifier">update_prompt</span> = <span class="ruby-string">&quot;&quot;</span>

        <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-ivar">@gemfile</span>) <span class="ruby-operator">==</span> <span class="ruby-constant">Injector</span><span class="ruby-operator">::</span><span class="ruby-constant">INJECTED_GEMS</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">requirements_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;&gt;= 0&quot;</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current</span>.<span class="ruby-identifier">requirements_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;&gt;= 0&quot;</span>)
            <span class="ruby-identifier">update_prompt</span> = <span class="ruby-string">&quot;. Gem already added&quot;</span>
          <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">update_prompt</span> = <span class="ruby-node">&quot;. If you want to update the gem version, run `bundle update #{current.name}`&quot;</span>

            <span class="ruby-identifier">update_prompt</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;. You may also need to change the version requirement specified in the Gemfile if it&#39;s too restrictive.&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">current</span>.<span class="ruby-identifier">requirements_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;&gt;= 0&quot;</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-string">&quot;You cannot specify the same gem twice with different version requirements.\n&quot;</span> \
                        <span class="ruby-node">&quot;You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})&quot;</span> \
                         <span class="ruby-node">&quot;#{update_prompt}&quot;</span>
      <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">current</span>.<span class="ruby-identifier">source</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">source</span>
        <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:development</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-string">&quot;You cannot specify the same gem twice coming from different sources.\n&quot;</span> \
                        <span class="ruby-node">&quot;You specified that #{dep.name} (#{dep.requirement}) should come from &quot;</span> \
                        <span class="ruby-node">&quot;#{current.source || &quot;an unspecified source&quot;} and #{dep.source}\n&quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n&quot;</span> \
                        <span class="ruby-string">&quot;You should probably keep only one of them.\n&quot;</span> \
                        <span class="ruby-string">&quot;Remove any duplicate entries and specify the gem only once.\n&quot;</span> \
                        <span class="ruby-string">&quot;While it&#39;s not a problem now, it could cause errors if you change the version of one of them later.&quot;</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@dependencies</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">dep</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gemspec" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gemspec</span><span
                                class="method-args">(opts = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="gemspec-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gemspec</span>(<span class="ruby-identifier">opts</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">opts</span> <span class="ruby-operator">||=</span> {}
  <span class="ruby-identifier">path</span>              = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:path</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&quot;.&quot;</span>
  <span class="ruby-identifier">glob</span>              = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:glob</span>]
  <span class="ruby-identifier">name</span>              = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:name</span>]
  <span class="ruby-identifier">development_group</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:development_group</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:development</span>
  <span class="ruby-identifier">expanded_path</span>     = <span class="ruby-identifier">gemfile_root</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>)

  <span class="ruby-identifier">gemspecs</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">glob_files_in_dir</span>(<span class="ruby-string">&quot;{,*}.gemspec&quot;</span>, <span class="ruby-identifier">expanded_path</span>).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">load_gemspec</span>(<span class="ruby-identifier">g</span>) }.<span class="ruby-identifier">compact</span>
  <span class="ruby-identifier">gemspecs</span>.<span class="ruby-identifier">reject!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">name</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>
  <span class="ruby-identifier">specs_by_name_and_version</span> = <span class="ruby-identifier">gemspecs</span>.<span class="ruby-identifier">group_by</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">s</span>.<span class="ruby-identifier">version</span>] }

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">specs_by_name_and_version</span>.<span class="ruby-identifier">size</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">specs_by_name_and_version</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">first</span>
    <span class="ruby-identifier">spec</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">match_platform</span>(<span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">local_platform</span>) } <span class="ruby-operator">||</span> <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">first</span>

    <span class="ruby-ivar">@gemspecs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">spec</span>

    <span class="ruby-identifier">gem</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span>, <span class="ruby-value">:name</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span>, <span class="ruby-value">:path</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">path</span>, <span class="ruby-value">:glob</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">glob</span>

    <span class="ruby-identifier">group</span>(<span class="ruby-identifier">development_group</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">development_dependencies</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dep</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">gem</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">dep</span>.<span class="ruby-identifier">requirement</span>.<span class="ruby-identifier">as_list</span> <span class="ruby-operator">+</span> [<span class="ruby-value">:type</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">:development</span>])
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-node">&quot;There are no gemspecs at #{expanded_path}&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-node">&quot;There are multiple gemspecs at #{expanded_path}. &quot;</span> \
      <span class="ruby-string">&quot;Please use the :name option to specify which one should be used&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-git" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">git</span><span
                                class="method-args">(uri, options = {}, &amp;blk)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="git-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 193</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">git</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">msg</span> = <span class="ruby-string">&quot;You can no longer specify a git source by itself. Instead, \n&quot;</span> \
          <span class="ruby-string">&quot;either use the :git option on a gem, or specify the gems that \n&quot;</span> \
          <span class="ruby-string">&quot;bundler should find in the git source by passing a block to \n&quot;</span> \
          <span class="ruby-string">&quot;the git method, like: \n\n&quot;</span> \
          <span class="ruby-string">&quot;  git &#39;git://github.com/rails/rails.git&#39; do\n&quot;</span> \
          <span class="ruby-string">&quot;    gem &#39;rails&#39;\n&quot;</span> \
          <span class="ruby-string">&quot;  end&quot;</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">DeprecatedError</span>, <span class="ruby-identifier">msg</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">with_source</span>(<span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_git_source</span>(<span class="ruby-identifier">normalize_hash</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">merge</span>(<span class="ruby-string">&quot;uri&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">uri</span>)), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-git_source" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">git_source</span><span
                                class="method-args">(name, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="git_source-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 167</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">git_source</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-string">&quot;You need to pass a block to #git_source&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">valid_keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-node">&quot;You cannot use #{name} as a git source. It &quot;</span> \
      <span class="ruby-node">&quot;is a reserved key. Reserved keys are: #{valid_keys.join(&quot;, &quot;)}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@git_sources</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">block</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-github" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">github</span><span
                                class="method-args">(repo, options = {}) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="github-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 208</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">github</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;GitHub sources require a block&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
  <span class="ruby-identifier">github_uri</span>  = <span class="ruby-ivar">@git_sources</span>[<span class="ruby-string">&quot;github&quot;</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">repo</span>)
  <span class="ruby-identifier">git_options</span> = <span class="ruby-identifier">normalize_hash</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">merge</span>(<span class="ruby-string">&quot;uri&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">github_uri</span>)
  <span class="ruby-identifier">git_source</span>  = <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_git_source</span>(<span class="ruby-identifier">git_options</span>)
  <span class="ruby-identifier">with_source</span>(<span class="ruby-identifier">git_source</span>) { <span class="ruby-keyword">yield</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-group" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">group</span><span
                                class="method-args">(*args) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="group-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 221</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">group</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> {}
  <span class="ruby-identifier">normalize_group_options</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">args</span>)

  <span class="ruby-ivar">@groups</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">args</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;optional&quot;</span>]
    <span class="ruby-identifier">optional_groups</span> = <span class="ruby-identifier">args</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@optional_groups</span>
    <span class="ruby-ivar">@optional_groups</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">optional_groups</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> { <span class="ruby-ivar">@groups</span>.<span class="ruby-identifier">pop</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-install_if" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">install_if</span><span
                                class="method-args">(*args) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="install_if-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 237</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">install_if</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-ivar">@install_conditionals</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">args</span>
  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> { <span class="ruby-ivar">@install_conditionals</span>.<span class="ruby-identifier">pop</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-method_missing" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">method_missing</span><span
                                class="method-args">(name, *args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="method_missing-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 264</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">method_missing</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">&quot;Undefined local variable or method `#{name}&#39; for Gemfile&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">path</span><span
                                class="method-args">(path, options = {}, &amp;blk)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="path-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 180</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">path</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-identifier">source_options</span> = <span class="ruby-identifier">normalize_hash</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">merge</span>(
    <span class="ruby-string">&quot;path&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>),
    <span class="ruby-string">&quot;root_path&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">gemfile_root</span>,
    <span class="ruby-string">&quot;gemspec&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">gemspecs</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">g</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;name&quot;</span>] }
  )

  <span class="ruby-identifier">source_options</span>[<span class="ruby-string">&quot;global&quot;</span>] = <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>

  <span class="ruby-identifier">source</span> = <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_path_source</span>(<span class="ruby-identifier">source_options</span>)
  <span class="ruby-identifier">with_source</span>(<span class="ruby-identifier">source</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-platform" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">platform</span><span
                                class="method-args">(*platforms)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Dsl.html#method-i-platforms">platforms</a>
                            </div>
                          </div>

                  <div id="method-i-platforms" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">platforms</span><span
                                class="method-args">(*platforms) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="platforms-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 244</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">platforms</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">platforms</span>)
  <span class="ruby-ivar">@platforms</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">platforms</span>
  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-identifier">platforms</span>.<span class="ruby-identifier">each</span> { <span class="ruby-ivar">@platforms</span>.<span class="ruby-identifier">pop</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Dsl.html#method-i-platform">platform</a>
                            </div>

                          </div>

                  <div id="method-i-plugin" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">plugin</span><span
                                class="method-args">(*args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="plugin-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 260</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">plugin</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-comment"># Pass on</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-source" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">source</span><span
                                class="method-args">(source, *args, &amp;blk)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="source-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 143</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">source</span>(<span class="ruby-identifier">source</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> {}
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">normalize_hash</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">source</span> = <span class="ruby-identifier">normalize_source</span>(<span class="ruby-identifier">source</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-string">&quot;type&quot;</span>)
    <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;type&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;type&quot;</span>].<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-constant">Plugin</span>.<span class="ruby-identifier">source?</span>(<span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;type&quot;</span>])
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-node">&quot;No plugin sources available for #{options[&quot;type&quot;]}&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-string">&quot;You need to pass a block to #source with :type option&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">source_opts</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-string">&quot;uri&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">source</span>)
    <span class="ruby-identifier">with_source</span>(<span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_plugin_source</span>(<span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;type&quot;</span>], <span class="ruby-identifier">source_opts</span>), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">with_source</span>(<span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_rubygems_source</span>(<span class="ruby-string">&quot;remotes&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">source</span>), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_global_rubygems_remote</span>(<span class="ruby-identifier">source</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_definition" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_definition</span><span
                                class="method-args">(lockfile, unlock)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="to_definition-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 216</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_definition</span>(<span class="ruby-identifier">lockfile</span>, <span class="ruby-identifier">unlock</span>)
  <span class="ruby-identifier">check_primary_source_safety</span>
  <span class="ruby-constant">Definition</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lockfile</span>, <span class="ruby-ivar">@dependencies</span>, <span class="ruby-ivar">@sources</span>, <span class="ruby-identifier">unlock</span>, <span class="ruby-ivar">@ruby_version</span>, <span class="ruby-ivar">@optional_groups</span>, <span class="ruby-ivar">@gemfiles</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-add_git_sources" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_git_sources</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_git_sources-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 275</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_git_sources</span>
  <span class="ruby-identifier">git_source</span>(<span class="ruby-value">:github</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">repo_name</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">repo_name</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">GITHUB_PULL_REQUEST_URL</span>
      {
        <span class="ruby-string">&quot;git&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;https://github.com/#{$1}.git&quot;</span>,
        <span class="ruby-string">&quot;branch&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-string">&quot;ref&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;refs/pull/#{$2}/head&quot;</span>,
        <span class="ruby-string">&quot;tag&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">nil</span>,
      }
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">repo_name</span> = <span class="ruby-node">&quot;#{repo_name}/#{repo_name}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">repo_name</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;/&quot;</span>)
      <span class="ruby-node">&quot;https://github.com/#{repo_name}.git&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">git_source</span>(<span class="ruby-value">:gist</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">repo_name</span><span class="ruby-operator">|</span>
    <span class="ruby-node">&quot;https://gist.github.com/#{repo_name}.git&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">git_source</span>(<span class="ruby-value">:bitbucket</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">repo_name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">user_name</span>, <span class="ruby-identifier">repo_name</span> = <span class="ruby-identifier">repo_name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;/&quot;</span>)
    <span class="ruby-identifier">repo_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">user_name</span>
    <span class="ruby-node">&quot;https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_path_source_safety" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_path_source_safety</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_path_source_safety-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 436</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_path_source_safety</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">global_path_source</span>.<span class="ruby-identifier">nil?</span>

  <span class="ruby-identifier">msg</span> = <span class="ruby-string">&quot;You can no longer specify a path source by itself. Instead, \n&quot;</span> \
          <span class="ruby-string">&quot;either use the :path option on a gem, or specify the gems that \n&quot;</span> \
          <span class="ruby-string">&quot;bundler should find in the path source by passing a block to \n&quot;</span> \
          <span class="ruby-string">&quot;the path method, like: \n\n&quot;</span> \
          <span class="ruby-string">&quot;    path &#39;dir/containing/rails&#39; do\n&quot;</span> \
          <span class="ruby-string">&quot;      gem &#39;rails&#39;\n&quot;</span> \
          <span class="ruby-string">&quot;    end\n\n&quot;</span>

  <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span>(<span class="ruby-value">2</span>, <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">strip</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_rubygems_source_safety" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_rubygems_source_safety</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_rubygems_source_safety-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 450</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_rubygems_source_safety</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">implicit_global_source?</span>
    <span class="ruby-identifier">implicit_global_source_warning</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">aggregate_global_source?</span>
    <span class="ruby-identifier">multiple_global_source_warning</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gemfile_root" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gemfile_root</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="gemfile_root-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 578</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gemfile_root</span>
  <span class="ruby-ivar">@gemfile</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">default_gemfile</span>
  <span class="ruby-ivar">@gemfile</span>.<span class="ruby-identifier">dirname</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-implicit_global_source_warning" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">implicit_global_source_warning</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="implicit_global_source_warning-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 458</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">implicit_global_source_warning</span>
  <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span> <span class="ruby-value">2</span>, <span class="ruby-string">&quot;This Gemfile does not include an explicit global source. &quot;</span> \
    <span class="ruby-string">&quot;Not using an explicit global source may result in a different lockfile being generated depending on &quot;</span> \
    <span class="ruby-string">&quot;the gems you have installed locally before bundler is run. &quot;</span> \
    <span class="ruby-string">&quot;Instead, define a global source in your Gemfile like this: source \&quot;https://rubygems.org\&quot;.&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-multiple_global_source_warning" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">multiple_global_source_warning</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="multiple_global_source_warning-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 465</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">multiple_global_source_warning</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">feature_flag</span>.<span class="ruby-identifier">bundler_3_mode?</span>
    <span class="ruby-identifier">msg</span> = <span class="ruby-string">&quot;This Gemfile contains multiple global sources. &quot;</span> \
      <span class="ruby-string">&quot;Each source after the first must include a block to indicate which gems &quot;</span> \
      <span class="ruby-string">&quot;should come from that source&quot;</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileEvalError</span>, <span class="ruby-identifier">msg</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span> <span class="ruby-value">2</span>, <span class="ruby-string">&quot;Your Gemfile contains multiple global sources. &quot;</span> \
      <span class="ruby-string">&quot;Using `source` more than once without a block is a security risk, and &quot;</span> \
      <span class="ruby-string">&quot;may result in installing unexpected gems. To resolve this warning, use &quot;</span> \
      <span class="ruby-string">&quot;a block to indicate which gems should come from the secondary source.&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-normalize_group_options" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">normalize_group_options</span><span
                                class="method-args">(opts, groups)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="normalize_group_options-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 390</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_group_options</span>(<span class="ruby-identifier">opts</span>, <span class="ruby-identifier">groups</span>)
  <span class="ruby-identifier">normalize_hash</span>(<span class="ruby-identifier">opts</span>)

  <span class="ruby-identifier">groups</span> = <span class="ruby-identifier">groups</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;:#{group}&quot;</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>)
  <span class="ruby-identifier">validate_keys</span>(<span class="ruby-node">&quot;group #{groups}&quot;</span>, <span class="ruby-identifier">opts</span>, <span class="ruby-node">%w[optional]</span>)

  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;optional&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-normalize_hash" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">normalize_hash</span><span
                                class="method-args">(opts)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="normalize_hash-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 312</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_hash</span>(<span class="ruby-identifier">opts</span>)
  <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">opts</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-normalize_options" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">normalize_options</span><span
                                class="method-args">(name, version, opts)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="normalize_options-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 323</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_options</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">opts</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">%(You need to specify gem names as Strings. Use &#39;gem &quot;#{name}&quot;&#39; instead)</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\s/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">%(&#39;#{name}&#39; is not a valid gem name because it contains whitespace)</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-string">%(an empty gem name is not valid)</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">normalize_hash</span>(<span class="ruby-identifier">opts</span>)

  <span class="ruby-identifier">git_names</span> = <span class="ruby-ivar">@git_sources</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:to_s</span>)
  <span class="ruby-identifier">validate_keys</span>(<span class="ruby-node">&quot;gem &#39;#{name}&#39;&quot;</span>, <span class="ruby-identifier">opts</span>, <span class="ruby-identifier">valid_keys</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">git_names</span>)

  <span class="ruby-identifier">groups</span> = <span class="ruby-ivar">@groups</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;group&quot;</span>] = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">&quot;groups&quot;</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;group&quot;</span>]
  <span class="ruby-identifier">groups</span>.<span class="ruby-identifier">concat</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">&quot;group&quot;</span>))
  <span class="ruby-identifier">groups</span> = [<span class="ruby-value">:default</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">groups</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">install_if</span> = <span class="ruby-ivar">@install_conditionals</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">install_if</span>.<span class="ruby-identifier">concat</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">&quot;install_if&quot;</span>))
  <span class="ruby-identifier">install_if</span> = <span class="ruby-identifier">install_if</span>.<span class="ruby-identifier">reduce</span>(<span class="ruby-keyword">true</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">memo</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:call</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">call</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">val</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">platforms</span> = <span class="ruby-ivar">@platforms</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;platforms&quot;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;platform&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;platforms&quot;</span>]
  <span class="ruby-identifier">platforms</span>.<span class="ruby-identifier">concat</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">&quot;platforms&quot;</span>))
  <span class="ruby-identifier">platforms</span>.<span class="ruby-identifier">map!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:to_sym</span>)
  <span class="ruby-identifier">platforms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">VALID_PLATFORMS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">p</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">&quot;`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># Save sources passed in a key</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-string">&quot;source&quot;</span>)
    <span class="ruby-identifier">source</span> = <span class="ruby-identifier">normalize_source</span>(<span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;source&quot;</span>])
    <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;source&quot;</span>] = <span class="ruby-ivar">@sources</span>.<span class="ruby-identifier">add_rubygems_source</span>(<span class="ruby-string">&quot;remotes&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">source</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">git_name</span> = (<span class="ruby-identifier">git_names</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">keys</span>).<span class="ruby-identifier">last</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@git_sources</span>[<span class="ruby-identifier">git_name</span>]
    <span class="ruby-identifier">git_opts</span> = <span class="ruby-ivar">@git_sources</span>[<span class="ruby-identifier">git_name</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">opts</span>[<span class="ruby-identifier">git_name</span>])
    <span class="ruby-identifier">git_opts</span> = { <span class="ruby-string">&quot;git&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">git_opts</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">git_opts</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">git_opts</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">_gemfile_value</span>, <span class="ruby-identifier">_git_source_value</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">%(The :#{key} option can&#39;t be used with `#{git_name}: #{opts[git_name].inspect}`)</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-node">%w[git path]</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">param</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">type</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">version</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">version</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*=?\s*(\d[^\s]*)\s*$/</span>
      <span class="ruby-identifier">options</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-string">&quot;name&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">name</span>, <span class="ruby-string">&quot;version&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">$1</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">options</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">dup</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">source</span> = <span class="ruby-identifier">send</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">param</span>, <span class="ruby-identifier">options</span>) {}
    <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;source&quot;</span>] = <span class="ruby-identifier">source</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;source&quot;</span>]         <span class="ruby-operator">||=</span> <span class="ruby-ivar">@source</span>
  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;env&quot;</span>]            <span class="ruby-operator">||=</span> <span class="ruby-ivar">@env</span>
  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;platforms&quot;</span>]      = <span class="ruby-identifier">platforms</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;group&quot;</span>]          = <span class="ruby-identifier">groups</span>
  <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;should_include&quot;</span>] = <span class="ruby-identifier">install_if</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-normalize_source" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">normalize_source</span><span
                                class="method-args">(source)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="normalize_source-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 422</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_source</span>(<span class="ruby-identifier">source</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">source</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:gemcutter</span>, <span class="ruby-value">:rubygems</span>, <span class="ruby-value">:rubyforge</span>
    <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span> <span class="ruby-value">2</span>, <span class="ruby-node">&quot;The source :#{source} is deprecated because HTTP &quot;</span> \
      <span class="ruby-string">&quot;requests are insecure.\nPlease change your source to &#39;https://&quot;</span> \
      <span class="ruby-string">&quot;rubygems.org&#39; if possible, or &#39;http://rubygems.org&#39; if not.&quot;</span>
    <span class="ruby-string">&quot;http://rubygems.org&quot;</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
    <span class="ruby-identifier">source</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">&quot;Unknown source &#39;#{source}&#39;&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-valid_keys" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">valid_keys</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="valid_keys-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 319</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">valid_keys</span>
  <span class="ruby-ivar">@valid_keys</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">VALID_KEYS</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_keys" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_keys</span><span
                                class="method-args">(command, opts, valid_keys)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_keys-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 399</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_keys</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">opts</span>, <span class="ruby-identifier">valid_keys</span>)
  <span class="ruby-identifier">invalid_keys</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">valid_keys</span>

  <span class="ruby-identifier">git_source</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">&amp;</span> <span class="ruby-ivar">@git_sources</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:to_s</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;branch&quot;</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;git&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;github&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">git_source</span>.<span class="ruby-identifier">any?</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileError</span>, <span class="ruby-node">%(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch)</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">invalid_keys</span>.<span class="ruby-identifier">any?</span>

  <span class="ruby-identifier">message</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-identifier">message</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;You passed #{invalid_keys.map {|k| &quot;:&quot; + k }.join(&quot;, &quot;)} &quot;</span>
  <span class="ruby-identifier">message</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">invalid_keys</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
    <span class="ruby-node">&quot;as options for #{command}, but they are invalid.&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-node">&quot;as an option for #{command}, but it is invalid.&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">message</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; Valid options are: #{valid_keys.join(&quot;, &quot;)}.&quot;</span>
  <span class="ruby-identifier">message</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; You may be able to resolve this by upgrading Bundler to the newest version.&quot;</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidOption</span>, <span class="ruby-identifier">message</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-with_source" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">with_source</span><span
                                class="method-args">(source) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="with_source-source">
            <pre><span class="ruby-comment"># File bundler/dsl.rb, line 301</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">with_source</span>(<span class="ruby-identifier">source</span>)
  <span class="ruby-identifier">old_source</span> = <span class="ruby-ivar">@source</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-ivar">@source</span> = <span class="ruby-identifier">source</span>
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">source</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-ivar">@source</span> = <span class="ruby-identifier">old_source</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

